#include <iostream>

int main(){
    int a[2][2] = {1,4,2,3};
    
    int x, y; std::cin >> x >> y;
    std::cout << a[x>0?0:1][y>0?0:1];
    return 0;
}